package demo1;

/**
 * Created with IntelliJ IDEA.
 * User: wenxiwen
 * Date: 2022/4/8
 * Time: 16:44
 * Description: No Description
 */
interface IAnimal {
     String name = "温习文";//默认是静态常量的  必须得赋值

     //void eat1();//默认是公开的抽象方法

     void eat() ;

    public static void pos() {
        System.out.println("这是父类的静态方法");
    }
}

class A implements IAnimal{

    @Override
    public void eat() {
        System.out.println("●");
    }


}

class B implements IAnimal {

    @Override
    public void eat() {

    }
}

class C implements IAnimal {
    @Override
    public void eat() {
        System.out.println("❀");
    }
}

class D implements IAnimal {

    @Override
    public void eat() {
        System.out.println("□");
    }
}
public class TestDemo {
    public static void fun(IAnimal animal) {
        animal.eat();
    }

    public static void main(String[] args) {
        A a = new A();
        B b= new B();
        C c = new C();
        D d = new D();

        fun(a);
        fun(b);
        fun(c);
        fun(d);
    }
   /* public static void main(String[] args) {
        A a = new A();
        a.eat();
        a.eat1();
        IAnimal.pos();
    }*/
}